package com.example.hellomap.rest;

import org.junit.Test;

import junit.framework.TestCase;

public class test_users extends TestCase {
	//GET
	@Test
	public void test_users_normal_get() {
		ServerInterface.get("users");
		ServerInterface.get("users/Akos");
	}
		
	@Test
	public void test_users_caseInsensitive_get() {
		ServerInterface.get("users/akos");
		ServerInterface.get("users/dORKa");
	}
	
	@Test
	public void test_users_doesNotExist_get() {
		ServerInterface.get("users/elemerce");
		//ServerInterface.get("elrontottam/elemerce");
		//ServerInterface.get("elrontottam");
	}
	
	//POST
	@Test
	public void test_users_normal_post() {
		users user = new users("Feri", "feripass", "feri@gmail.com");
		ServerInterface.post("users", user);
		ServerInterface.get("users");
		
		users user2 = new users();
		user2.setId("Bill");
		ServerInterface.post("users", user2);
		ServerInterface.get("users");
	}
	
	@Test
	public void test_users_ShouldBeDuplicateUsernameError() {
		users user = new users("Eszti", "eszterpass", "eszti@gmail.com");
		ServerInterface.post("users", user);
		ServerInterface.post("users", user);
		ServerInterface.get("users");
	}
	
	@Test
	public void test_users_NotExistingCollectionError() {
		users user = new users("Eszti", "eszterpass", "eszti@gmail.com");
		ServerInterface.post("collection", user);
	}
	
	@Test
	public void test_users_NotExistingIdPostError() {
		users user = new users();
		ServerInterface.post("users", user);
		ServerInterface.get("users");
	}
	
	@Test
	public void test_users_NotValidEmailError() {
		users user = new users("Eszti", "eszterpass", "@@eszti@gmail.");
		ServerInterface.post("users", user);
		ServerInterface.get("users");
	}

	//DELETE
	@Test
	public void test_users_normal_delete() {
		ServerInterface.delete("users", "Csilla");
	}
	
	public void test_users_DoesNotExist_delete() {
		ServerInterface.delete("users", "Geza");
	}
	
	public void test_DoesNotExist_collection_delete() {
		ServerInterface.delete("felhasznalok", "Geza");
	}

	//PUT
	public void test_users_normal_putPass() {
		ServerInterface.updateUser("Szabi", "ororszlan", "pass");
	}
	public void test_users_normal_addEvent() {
		ServerInterface.updateUser("Dorka", "ujesemeny", "event_id");
	}

	public void test_users_normal_putEvent() {
		ServerInterface.updateUser("Dorka", "nana", "public_events");
	}
	
	public void test_users_normal_removeEvent() {
		ServerInterface.updateUser("Dorka", "nana", "remove_event");
	}
	
	public void test_users_notExisting_removeEvent() {
		ServerInterface.updateUser("Dorka", "dob", "remove_event");
	}
	
}
